package com.youmu.shop.integral.controller;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.exception.ParamException;
import com.result.Result;
import com.result.ResultUtils;
import com.youmu.shop.integral.service.IntegralService;
import com.youmu.shop.integral.vo.IntegralVO;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;


@RestController
@RequestMapping(value = "/integral/remote/")
public class IntegralController {

    
	@Resource
    private IntegralService integralService;
    
	@ApiOperation(value = "获取积分")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "userId", value = "用户id", required = true, dataType = "long", paramType = "query"),
	})
   	@RequestMapping(value = "getIntegral",method=RequestMethod.GET)
   	public Result<IntegralVO> findIntegral(Long userId,Integer status) {
		if(userId == null){
			throw new ParamException("userId不能为空");
		}
       	IntegralVO  integralVO = integralService.getIntegral(userId);
       	return ResultUtils.createDefResult(integralVO);
   	}
	
}